package com.yj.springbootmybatis.handler;

import com.yj.springbootmybatis.util.ResponseUtil;
import org.apache.tomcat.util.http.fileupload.impl.SizeLimitExceededException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.multipart.MaxUploadSizeExceededException;

@RestControllerAdvice
public class CustomExceptionHandler {


//SizeLimitExceededException
    @ExceptionHandler(value = MaxUploadSizeExceededException.class)
    public ResponseUtil catchSizeLimitExceededException(MaxUploadSizeExceededException e){


            return ResponseUtil.error().message("图片大小不能超过500kb！");

    }

}
